package worldinruin.rules;

import worldinruin.core.IPlayer;
import worldinruin.core.ITile;
import worldinruin.core.ITroop;
import worldinruin.core.imp.Troop;
import worldinruin.core.imp.buildings.BuildingTypes;


public interface IRules {
	
	/**
	 * Calculates speed for a troop.
	 * @param t Troop
	 * @return Number of tiles the troop can travel.
	 */
	int calculateSpeed(ITroop t);

	/**
	 * Returns building types for a tile.
	 * @param tile Tile type on gameboard.
	 * @return Building type.
	 */
	public BuildingTypes getAvailableBuildings(ITile tile);
		
	/**
	 * Gets possible directions for a troop.
	 * @param troop Troop on gameboard.
	 * @param dep The troops tile position.
	 * @return Different tiles the troop can go to.
	 */
	public ITile[] getPossibleDestinations(Troop troop, ITile dep);
	
	/**
	 * Checks if a player is defeated.
	 * @param p Player.
	 * @return True if player has been defeated, false if not.
	 */
	public boolean isDefeated(IPlayer p);

	/**
	 * Checks if a move is legal for a troop.
	 * @param from Starting position.
	 * @param to End destination.
	 * @param troop Troop that is subject to move.
	 * @return True if legal, false if not.
	 */
	boolean isPossibleMove(ITile from, ITile to, ITroop troop);
	
}
